import { bannerList,bannerEdit } from '../../../request/api'

const state = {
    bannerList: [],//列表数据
    page: 1,
    size: 5,
    count: 0
}
const getters = {
    getBannerList(state) {
        return state.bannerList
    },
    getSize(state) {
        return state.size
    },
    getCount(state) {
        return state.count
    }
}
const mutations = {
    REQ_BANNERLIST(state, payload) {
        state.bannerList = payload
    },
    REQ_COUNT(state, payload) {
        state.count = payload
    },
    CHANGE_PAGE(state, payload) {
        state.page = payload
    },
}
const actions = {
    getBannerAction({ commit }) {
        console.log(1.1);
        bannerList().then(res => {
            console.log(1.2);
            commit('REQ_BANNERLIST', res.list)
            console.log(1.3);
        })
        console.log(1.4);
    }
}

export default {
    state,
    getters,
    mutations,
    actions,
    namespaced: true
}